<script type="text/javascript">
        var m = 1;
        var s = 31;
        
        function start_timer()
        {   
            if (s > 0)
                s--;
            else 
                if (m > 0) {
	                s = 60;
	                m--;
	            }

        	if (m > 0) {
            	if (s <= 9)
                	s = '0' + s;
            	time_left = m + ":" + s;
        	}
        	else
            	time_left = s;

            document.getElementById('timer').innerHTML = time_left;
        	
            //If time is up
            if ((m == 0) && (s == 0)) {
	            //Redirect to dashboard
            	window.location = "index.php";
            }
            else
            {
                //Call the function again after 1 second delay
                window.setTimeout("start_timer()", 1000);
            }
        }
        window.onload=start_timer;
</script>

<?php 

include 'header.php';

if (!isset($_SESSION['username'])) {
	include 'unauthorized.php';
	include 'footer.php';
	exit();
}

if ($_GET['level'] > $_SESSION['level'])
	echo "<div style='color:red'>Warning: This is intentionally left as an open door for now, but later access to this level won't be allowed unless you earned the points for it.</div>";

if ($_GET['level'] == 0)
	include 'guess_face_shape.php';
elseif ($_GET['level'] == 1)
	include 'choose_better_frame.php';

include 'footer.php';

?>